define(['aForm'], function (Form) {
    function ViewModel(params) {
        var scope = this;

        scope.fields = ['title',{name:'uploadFile',notify:true}];
        scope.onModelChange = function(field){
            if(params.record&&params.record.uploadFile.file){
                var file = params.record.uploadFile.file();

                if(file){
                    params.record.title(file.name);
                }
                else {
                    params.record.title('');
                }
            }
        };
        scope.callParent(params);
    }

    ViewModel.extend(Form);

    return ViewModel;
});
